#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, x;
	priority_queue<int> q;
	cin>>n;
	while(n--)
	{
		cin>>x;
		q.push(x);
	}
	cin>>n;
	while(n--)
	{
		cin>>x;
		q.push(x);
	}
	while(!q.empty())
	{
		cout<<q.top()<<" ";
		q.pop();
	}
	return 0;
}

